chore: rivetkit core/napi/typescript follow up review#4702
Conversation
|
🚅 Deployed to the rivet-pr-4702 environment in rivet-frontend
|
|
PR 4702 Code Review — Adversarial Review Synthesis The full adversarial review findings (F1-F42) with challenger verdicts are in this comment. The per-diff code review is in the comment below. Key findings verified as REAL in this PR:
|
689feea to
527f1d2
Compare
f102f4d to
8264cd3
Compare
527f1d2 to
ef109dd
Compare
a639b2e to
d7cd40d
Compare
PR Review: chore: rivetkit core/napi/typescript follow up reviewOverviewThis is a substantial follow-up cleanup across rivetkit-core, NAPI, and TypeScript layers. Key additions:
Potential Bugs1. Race condition in // Request A and B both see None here simultaneously
if let Some(runtime) = self.serverless_runtime.lock().as_ref().cloned() {
return Ok(runtime);
}
// Both proceed to take the registry — second caller gets "registry already serving"
let registry = { let mut guard = self.inner.lock(); guard.take()... };Two concurrent requests on a cold serverless runtime can both see 2. fn maybe_respond_to_raw_hibernatable_ack_state_probe(...) -> bool {
if env::var_os("VITEST").is_none() || message.binary {
return false;
}Test-specific behavior is gated by a 3. Sleep timer not reset on clean run exit ( When Security4. CORS reflects arbitrary origins with fn cors_headers(req: &ServerlessRequest) -> HashMap<String, String> {
let origin = req.headers.get("origin").cloned()
.unwrap_or_else(|| "*".to_owned());
headers.insert("access-control-allow-credentials".to_owned(), "true".to_owned());Reflecting any 5. if let Some(client_token) = &self.settings.client_token {
object.insert("clientToken".to_owned(), json!(client_token));
}
Code Quality6. Backpressure in const backpressureWaiters: Array<() => void> = [];
const waitForBackpressure = async () => {
await new Promise<void>((resolve) => { backpressureWaiters.push(resolve); });
};This is an ad-hoc Promise queue. CLAUDE.md requires using 7. function sqlReturnsRows(query: string): boolean {
// "WITH" branch catches all CTEs, including mutating ones without RETURNING
return token.startsWith("WITH") || ...
}
function hasMultipleStatements(query: string): boolean {
// Semicolons inside string literals or comments are false positives
return trimmed.includes(";");
}Both functions can be tripped by edge-case SQL. 8. fn bytes_response(...) -> ServerlessResponse {
let (tx, rx) = mpsc::channel(1);
tokio::spawn(async move { let _ = tx.send(Ok(body)).await; });This spawns a Tokio task to enqueue a single message on a channel with capacity 1. The send always completes without blocking, so the spawn is unnecessary overhead on every health/metadata/error response. Minor Notes
This review was updated on 2026-04-24. |
Preview packages published to npmInstall with: npm install rivetkit@pr-4702All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-76b6c25
docker pull rivetdev/engine:full-76b6c25Individual packagesnpm install rivetkit@pr-4702
npm install @rivetkit/react@pr-4702
npm install @rivetkit/rivetkit-napi@pr-4702
npm install @rivetkit/workflow-engine@pr-4702 |
Preview packages published to npmInstall with: npm install rivetkit@pr-4702All packages published as Engine binary is shipped via Docker images: docker pull rivetdev/engine:slim-d108c6a
docker pull rivetdev/engine:full-d108c6aIndividual packagesnpm install rivetkit@pr-4702
npm install @rivetkit/react@pr-4702
npm install @rivetkit/rivetkit-napi@pr-4702
npm install @rivetkit/workflow-engine@pr-4702 |
9284ef8 to
f7dae0a
Compare
f7dae0a to
69857a0
Compare
8c07fbd to
fb56daa
Compare
3b4d928 to
2a88f8f
Compare
2a88f8f to
d22906f
Compare
d22906f to
6d9c3e8
Compare
24be269 to
cef23e2
Compare
6d9c3e8 to
226d1d0
Compare
|
Landed in main via stack-merge fast-forward push. Commits are in main; closing to match. |

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context.
Type of change
How Has This Been Tested?
Please describe the tests that you ran to verify your changes.
Checklist: